<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/2/9
  Time: 12:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/css/style.min.css" rel="stylesheet">
    <link href="/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/main.min.js"></script>
    <script type="text/javascript" src="/layui/layui.js"></script>
</head>
<body>
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">
                    <label>座位预约进度</label>
                    <div class="layui-progress layui-progress-big" lay-filter="demo" lay-showPercent="true">
                        <div class="layui-progress-bar" lay-percent="20"></div>
                    </div>
                    <br>
                    <button class="layui-btn" onclick="adminOp(0)">0点操作</button>
                    <button class="layui-btn layui-btn-normal" onclick="adminOp(7)">上午7点操作</button>
                    <button class="layui-btn layui-btn-warm" onclick="adminOp(12)">中午12点操作</button>
                    <button class="layui-btn layui-btn-danger" onclick="adminOp(10)">下午10点操作</button>
                    <br>
                    <div class="layui-card">
                        <div class="layui-card-header">指令说明</div>
                        <div class="layui-card-body">
                            <h4>7点操作</h4>
                                图书馆每天上午7点开门，当时间达到7点，所有预定了上午的座位的记录状态全部变为正在使用
                            <h4>12点操作</h4>
                                到达中午12点时，所有上午预约的座位记录，全部变为结束，下午的预约记录全部变为正在使用
                            <h4>22点操作</h4>
                                 到达下午22点时，当天所有的记录全部变为空闲
                            <h4>24点操作</h4>
                                 到达24点时，预约状态全变为空闲，当天被预约的座位变为未开始
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    $(function () {
        layui.use(["layer","element"],function () {
                var layer=layui.layer;
                var element=layui;
            window.adminOp=function (clock) {
                if (clock==0){
                    $.ajax({
                        type:"post",
                        url:"/seat/adminOperating.action",
                        dataType:"json",
                        success:function (data) {
                            if (data.code!=0){
                                layer.msg("操作成功,操作了"+data.code+"条数据")
                            }else{
                                layer.msg("无数据可操作")
                            }
                        }
                    })
                }else{
                    $.ajax({
                        type:"post",
                        url:"/selectSeat/adminOperating.action",
                        data:{clock:clock},
                        dataType:"json",
                        success:function (data) {
                            if (data.code!=0){
                                layer.msg("操作成功,操作了"+data.code+"条数据")
                            }else{
                                layer.msg("无数据可操作")
                            }
                        }
                    })
                }
            }

            window.selectNum=function () {
                $.ajax({
                    type:"get",
                    url:"/seat/getNum.action",
                    dataType:"json",
                    success:function (data) {
                        element.progress('demo', parseFloat((data.num/data.count * 100).toPrecision(12))+"%");
                    }
                })
            }
        })

    })
</script>
</html>
